<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Reward extends Model
{
    protected $table = "c_rewards";

    /**
     * @param $data
     * 打赏
     */
    public function addReward($data)
    {
        $this->money = $data['money'];
        $this->user_id = $data['user_id'];
        $this->doctor_id = $data['doctor_id'];
        $this->sn = (new Order())->orderNumber();
        return $this->save();
    }

    /****
     * @param $order_id
     * @return mixed
     * 打赏详情
     */
    public static function getRewardDetail($order_id)
    {
        return self::where([['id', '=', $order_id]])->first();
    }
}
